.deepseek-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  scroll-behavior: smooth;
}

.deepseek-welcome {
  text-align: center;
  padding: 40px 20px;
  color: var(--deepseek-secondary-text);
}

.deepseek-welcome h2 {
  color: var(--deepseek-text);
  margin-bottom: 10px;
}

.deepseek-message {
  display: flex;
  flex-direction: row;
  align-items: flex-end;
  width: 100%;
  padding: 0 16px;
  margin-bottom: 40px;
  position: relative;
}

.deepseek-message-user {
  display: flex;
  flex-direction: row;
  justify-content: flex-end;
  align-items: flex-end;
}

.deepseek-message-ai {
  align-items: flex-start;
}

.deepseek-message-ai .message-content-wrapper {
  position: relative;
  display: inline-block;
  width: auto;
  max-width: 85%;
}

.message-content {
  max-width: 100%;
  min-width: 60px;
  min-height: 40px;
  padding: 10px 16px;
  border-radius: 12px;
  background: var(--deepseek-bg-secondary);
  color: var(--deepseek-text);
  font-size: 15px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: break-word;
  position: relative;
  display: block;
}

.deepseek-message-user .message-content {
  max-width: 48vw;
  min-width: 60px;
  width: auto;
  display: inline-block;
  background: var(--deepseek-primary);
  color: white;
  padding-bottom: 15px;
  white-space: pre-wrap;
  word-break: break-word;
}

.deepseek-message-ai .message-content,
.deepseek-message-ai .message-content-wrapper .message-content {
  background-color: var(--deepseek-message-ai-bg);
  color: var(--deepseek-text);
  border: 1px solid var(--deepseek-border);
  border-top-left-radius: 4px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
  transition: min-height 0.3s ease;
  padding-bottom: 40px;
}

.message-actions {
  position: absolute;
  right: 8px;
  bottom: 8px;
  display: flex;
  flex-direction: row;
  gap: 4px;
  background: rgba(255, 255, 255, 0.9);
  padding: 4px;
  border-radius: 4px;
  opacity: 0;
  transition: opacity 0.2s;
  z-index: 1;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.message-content-wrapper:hover .message-actions {
  opacity: 1;
}

.message-actions i {
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: all 0.2s;
  font-size: 14px;
  color: var(--deepseek-text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
}

.message-actions i:hover {
  background: var(--deepseek-bg-secondary);
  color: var(--deepseek-primary);
  transform: scale(1.1);
}

.message-actions i.liked {
  color: var(--success-color);
}

.message-actions i.disliked {
  color: var(--danger-color);
}

.timestamp {
  position: absolute;
  bottom: -24px;
  font-size: 12px;
  color: var(--deepseek-text-secondary);
  background: var(--deepseek-bg);
  padding: 2px 8px;
  border-radius: 4px;
  z-index: 1;
}

.deepseek-message-user .timestamp {
  right: 16px;
}

.deepseek-message-ai .timestamp {
  left: 16px;
}

.deepseek-input-container {
  padding: 16px;
  border-top: 1px solid var(--deepseek-border);
  background-color: var(--deepseek-chat-bg);
  position: relative;
}

.deepseek-textarea {
  width: 100%;
  min-height: 48px;
  max-height: 150px;
  padding: 12px 16px;
  padding-right: 90px;
  border: 1px solid var(--deepseek-border);
  border-radius: 8px;
  resize: none;
  font-size: 0.95rem;
  line-height: 1.5;
  outline: none;
  font-family: inherit;
  transition: all 0.3s;
}

.deepseek-textarea:focus {
  border-color: var(--deepseek-primary);
  box-shadow: 0 0 0 2px rgba(41, 112, 255, 0.2);
}

.deepseek-input-actions {
  position: absolute;
  right: 26px;
  bottom: 26px;
  display: flex;
  gap: 5px;
  height: 36px;
  z-index: 100;
}

.deepseek-voice-input,
.deepseek-file-upload,
.deepseek-send-button {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid var(--deepseek-border);
  background-color: white;
  color: var(--deepseek-secondary-text);
}

.deepseek-voice-input:hover,
.deepseek-file-upload:hover {
  background-color: var(--deepseek-hover);
  color: var(--deepseek-primary);
  transform: scale(1.05);
}

.deepseek-send-button {
  background-color: var(--deepseek-primary);
  color: white;
  border: none;
}

.deepseek-send-button:hover {
  background-color: #1a56db;
  transform: scale(1.05);
}

.deepseek-voice-input:disabled,
.deepseek-file-upload:disabled,
.deepseek-send-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.file-previews-container {
  padding: 10px 16px;
  background-color: var(--deepseek-hover);
  border-top: 1px solid var(--deepseek-border);
}

.file-preview {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background-color: white;
  border-radius: 6px;
  margin-bottom: 8px;
  border: 1px solid var(--deepseek-border);
}

.file-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.file-name {
  color: var(--deepseek-text);
  font-weight: 500;
}

.file-size {
  color: var(--deepseek-secondary-text);
  font-size: 0.9rem;
}

.remove-file {
  background: none;
  border: none;
  color: var(--danger-color);
  cursor: pointer;
  padding: 4px;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s;
}

.remove-file:hover {
  background-color: var(--deepseek-hover);
  transform: scale(1.1);
}

/* Markdown 样式 */
.deepseek-message-ai .message-content {
  /* 标题样式 */
  h1, h2, h3, h4, h5, h6 {
    margin-top: 0.5em;
    margin-bottom: 0.5em;
    color: var(--deepseek-text);
  }

  /* 代码样式 */
  code {
    background-color: var(--deepseek-hover);
    padding: 2px 4px;
    border-radius: 3px;
    font-family: monospace;
  }

  pre {
    background-color: var(--deepseek-hover);
    padding: 16px;
    border-radius: 6px;
    overflow-x: auto;
    margin: 10px 0;
    border: 1px solid var(--deepseek-border);

    code {
      background: transparent;
      padding: 0;
    }
  }

  /* 表格样式 */
  table {
    border-collapse: collapse;
    width: 100%;
    margin: 10px 0;
  }

  th, td {
    border: 1px solid var(--deepseek-border);
    padding: 8px;
  }

  th {
    background-color: var(--deepseek-hover);
  }

  /* 引用样式 */
  blockquote {
    border-left: 3px solid var(--deepseek-border);
    padding-left: 10px;
    color: var(--deepseek-secondary-text);
    margin: 10px 0;
  }

  /* 列表样式 */
  ul, ol {
    padding-left: 20px;
    margin: 3px 0;
  }

  li {
    margin: 2px 0;
  }

  /* 链接样式 */
  a {
    color: var(--deepseek-primary);
    text-decoration: none;
  }

  a:hover {
    text-decoration: underline;
  }

  /* 图片样式 */
  img {
    max-width: 100%;
    border-radius: 4px;
    margin: 10px 0;
  }

  /* 分割线样式 */
  hr {
    border: none;
    border-top: 1px solid var(--deepseek-border);
    margin: 20px 0;
  }
}

.thinking-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: var(--deepseek-bg-secondary);
  border-radius: 12px;
  color: var(--deepseek-text);
  font-size: 14px;
  min-height: 40px;
}

.thinking-indicator .spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--deepseek-primary);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.error-message {
  color: var(--deepseek-danger);
  padding: 12px 16px;
  font-size: 0.9rem;
}

/* 打字机效果样式 */
.typing {
  display: inline-block;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: break-word;
  min-height: 1.2em;
  width: 100%;
  flex: 1;
}

.typed-cursor {
  color: var(--deepseek-primary);
  font-weight: bold;
  display: inline-block;
  min-width: 2px;
  height: 1.2em;
  vertical-align: middle;
}

/* 消息内容区域优化 */
.message-content > div {
  width: 100%;
  min-height: 1.2em;
  /* 移除 display: flex; flex-direction: column; 只保留必要的宽高 */
  display: flex;
  flex-direction: column;
  padding-right: 8px;
}

/* 用户消息样式 */
.deepseek-message-user .message-content {
  background: var(--deepseek-primary);
  color: white;
  padding-bottom: 0;
}

.deepseek-message-user .message-actions {
  background: rgba(255, 255, 255, 0.2);
  max-width: 40px;
}

.deepseek-message-user .message-actions i {
  color: white;
}

.deepseek-message-user .message-actions i:hover {
  background: rgba(255, 255, 255, 0.3);
  color: white;
}

/* AI消息样式 */
.deepseek-message-ai .message-content {
  background-color: var(--deepseek-message-ai-bg);
  color: var(--deepseek-text);
  border: 1px solid var(--deepseek-border);
  border-top-left-radius: 4px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
  transition: min-height 0.3s ease;
  padding-bottom: 40px;
}

/* markdown 兼容性增强 */
.message-content pre, .message-content code {
  font-family: 'Fira Mono', 'Consolas', 'Menlo', monospace;
  font-size: 14px;
  background: #f6f8fa;
  border-radius: 4px;
  padding: 8px;
  overflow-x: auto;
  color: #222;
}

.message-content pre {
  margin: 10px 0;
  background: #f6f8fa;
  border: 1px solid var(--deepseek-border);
}

.message-content code {
  padding: 2px 4px;
  background: #f6f8fa;
  border-radius: 3px;
}

.message-content h1, .message-content h2, .message-content h3, .message-content h4, .message-content h5, .message-content h6 {
  margin: 10px 0 6px 0;
  font-weight: bold;
  color: var(--deepseek-text);
}

.message-content ul,
.message-content ol {
  margin: 0.08em 0 0.08em 1.5em;
  padding-left: 0;
}

.message-content ul li,
.message-content ol li {
  margin: 0.04em 0;
  padding-left: 0;
}

.message-content blockquote {
  border-left: 3px solid var(--deepseek-border);
  padding-left: 10px;
  color: var(--deepseek-secondary-text);
  margin: 10px 0;
  background: #f6f8fa;
  border-radius: 4px;
}

.message-content hr {
  border: none;
  border-top: 1px solid var(--deepseek-border);
  margin: 20px 0;
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #f2f3f5;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  margin-right: 14px;
  margin-left: 0;
  flex-shrink: 0;
}

.deepseek-message-user .avatar {
  margin-right: 8px;
}

.deepseek-message-ai .avatar {
  background: #e3f2fd;
  color: #2196f3;
}

/* 优化段落、列表、空白行间距 */
.message-content p,
.message-content ul,
.message-content ol,
.message-content li,
.message-content blockquote,
.message-content pre,
.message-content table {
  margin-top: 0.4em;
  margin-bottom: 0.4em;
}

/* 优化标题字号和间距 */
.message-content h1 {
  font-size: 1.35em;
  margin: 0.6em 0 0.3em 0;
  font-weight: bold;
}
.message-content h2 {
  font-size: 1.18em;
  margin: 0.5em 0 0.25em 0;
  font-weight: bold;
}
.message-content h3 {
  font-size: 1.08em;
  margin: 0.4em 0 0.2em 0;
  font-weight: bold;
}

.copy-code-btn {
  position: absolute;
  top: 8px;
  right: 12px;
  background: #f6f8fa;
  border: 1px solid var(--deepseek-border);
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 14px;
  color: var(--deepseek-text-secondary);
  cursor: pointer;
  z-index: 2;
  transition: background 0.2s, color 0.2s;
}
.copy-code-btn:hover {
  background: var(--deepseek-primary);
  color: #fff;
  border-color: var(--deepseek-primary);
}

.message-content p,
.message-content li,
.message-content span,
.message-content div {
  font-size: inherit;
} 